<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>胸围计算</title>
</head>
<body>
    <p>放大到可观测宇宙直径</p>
    <input type="text" id="height" placeholder="请输入身高(cm)">
    <input type="text" id="up_breast" placeholder="上胸围(cm)">
    <input type="text" id="down_breast" placeholder="下胸围(cm)">
    <button onclick="calcuate()">计算</button>
    <h3>计算结果</h3>
    <p id="result"></p>
    <script>function calcuate()
    {
        var height = document.getElementById("height").value
        var up_breast = document.getElementById("up_breast").value
        var down_breast = document.getElementById("down_breast").value
        const rate = 8.8* Math.pow(10, 28) / height
        var result_down_breast = down_breast * rate
        var result_up_breast = up_breast * rate
         // 换算到光年单位（1光年 ≈ 9.461e17 cm）
        var result_up_breast_light_year = result_up_breast / (9.461 * Math.pow(10, 17));
        var result_down_breast_light_year = result_down_breast / (9.461 * Math.pow(10, 17));
        
        const resultP = document.getElementById("result");
        resultP.innerHTML = "上胸围：" + result_up_breast + "cm (" + result_up_breast_light_year.toExponential(2) + " 光年)" + "<br>" + 
                        "下胸围：" + result_down_breast + "cm (" + result_down_breast_light_year.toExponential(2) + " 光年)";
    }</script>
</body>
</html>